package com.heima.utils.threadlocal;


import com.heima.model.wemedia.pojos.WmUser;

/**
 * @Description:
 * @Version: V1.0
 */
public class WmThreadLocalUtils {


    private final static ThreadLocal<WmUser> userThreadLocal = new ThreadLocal<>();


    /**
     * 设置当前线程中的用户
     * @param user
     */
    public static void setUser(WmUser user){
        userThreadLocal.set(user);
    }

    /**
     * 获取线程中的用户
     * @return
     */
    public static WmUser getUser( ){
        return userThreadLocal.get();
    }

    /**
     * 清除当前线程用户
     */
    public static void remove() {
        userThreadLocal.remove();
    }

}